const path = require("path");
const CleanWebpackPlugin = require("clean-webpack-plugin");
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
    entry: path.join(__dirname, 'src/main.js'), // 入口文件
    output: {
        filename:'[name].[hash].js',
        path: path.resolve(__dirname, "dist")
    },
    plugins:[
        new HtmlWebpackPlugin({
            templateParameters: {
                BASE_URL: './'
            },
            title: "zzy Webpack Vue App",
            template: path.join(__dirname, "./public/index.html"),//指定模版文件路径
            filename: "index.html"//设置内存中页面名称
        }),
        new MiniCssExtractPlugin({
            filename: "[name][contentHash:8].css",
            chunkFilename: "[id].css"
        }),
        new VueLoaderPlugin(),
        new CleanWebpackPlugin(['dist'])
    ]
}